<?php
namespace LANGUAGE_EXCHANGE;
include_once 'Word_segmentation/Word_segmentation.class.php';
/*
 * 语言交流 处理一些自然语言
 */
class Language_exchange{
    /*
     * @var string lang 语言 
     */
    protected $lang;
    
    /*
     * @var string lang 分词对象
     */
    protected $segmentation;
    /*
     * 构造方法
     */
    public function __construct()
    {
        include_once 'Word_segmentation/Scws.class.php';
        $this->segmentation = new Scws();
    }
    /*
     * 处理分词
     */
    public function word_segmentation()
    {
        $this->segmentation->set_text($this->lang);
        $this->lang = $this->segmentation->exec();
    }
    /*
     * 设置需要分词的字符串
     * @param string lang
     * @return void
     */
    public function set_lang($lang)
    {
        $this->lang = is_string($lang)?$lang:false;
    }
    /*
     * 获得最后的结果
     */
    public function get_lang()
    {
        return $this->lang;
    }
}